package com.hr.User.controller;

import com.hr.User.entity.UserTable;
import com.hr.User.service.UserService;
import com.hr.util.Result;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

/**
 * @author DSL
 * @create 2024-10-31 11:14
 */
@CrossOrigin(origins = "*")
@RestController
@RequestMapping("/api/user")
public class UserController {
    @Resource//自动注入
    private UserService userService;
    @PostMapping   ("/getPhone/{phone}")
    public Result<UserTable> getPhone(@PathVariable String phone){
        return Result.success(userService.selectByPhone(phone));
    }
//    添加用户信息
    @PostMapping("/addUser")
    public Result<Integer> addUser(@RequestBody UserTable userTable){
        return Result.success(userService.insertUser(userTable));
    }
}
